<?php
class Dapan extends Zend_Db_Table_Abstract{
    protected $_name;
    protected $_primary = 'dapan_id';

    function __construct() {
        $this->_name = DB_PREFIX . "dapan";
        parent::__construct(); 
    }    
    public function getPrimaryKey() {
        $pk = $this->_primary;
        if (is_array($pk)) {
            if (count($pk) > 0)
                return $pk[1]; // array[1] contain column name of primary key
        }
        return $this->_primary;
    }
    /**
     * This is funciton to get all cauhoi
     *
     * @author quanvo
     */
    public function getDapanByCauhoi($cauhoi_id){
    	$table_name = $this->_name;
        // get parent node and current node
        $select = Zend_Db_Table_Abstract::select();
        $select->from(array('d' => $table_name))
        ->where("d.cauhoi_id = $cauhoi_id")
        ;

        $data = $this->fetchAll($select);
        return $data;
    }
    public function getDapanByWhere($where = null){
        // get parent node and current node
        $select = Zend_Db_Table_Abstract::select();       
        if($where != null){
        	$select->where($where);
        }

        $data = $this->fetchRow($select);
        return $data;
    }
}
?>
